import { map } from "@/core";
import { SpaceHorizontalProfile } from "@/core/MapElement/SpaceHorizontalProfile";
import { getGUI } from "@/global/menu";


const profile=map.elements.get('空间水平剖面') as SpaceHorizontalProfile


export function main() {
  const gui = getGUI('空间水平剖面')
  let heights=profile.heights
  gui.add(profile,'show')
  gui.add({
    剖面数:heights.length
  },'剖面数',0,10,1).onFinishChange((val:number)=>{
    const step=14000/val
    heights=Array.from({
      length:val
    },(_e,i)=>{
      return step+step*i
    })
    folder.destroy()
    folder=gui.addFolder('剖面高度')
    heights.forEach((_e,i)=>{
      folder.add( heights,i.toString(),500,14000,100).onChange(()=>{
        profile.heights=[...heights]
      })
    })
    profile.heights=heights
  })

  let folder=gui.addFolder('剖面高度')
  heights.forEach((_e,i)=>{
    folder.add( heights,i.toString(),500,14000,100).onChange(()=>{
      profile.heights=[...heights]
    })
  })
}
